<template>
    <input type="text" placeholder="请输入..." v-model="val">
    <button @click="handelAdd">提交</button>
</template>

<script setup> 
    import {ref,defineEmits} from "vue"
    let val = ref("")
    let emit = defineEmits(['add'])
    let handelAdd = ()=>{
        emit('add',val.value)
    }
</script>
<style scoped>
    input{
        margin: 0  0 0 140px;
    }
</style>